using System;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Collections.Generic;
using GoogleEarthClasses.Global;
using GoogleEarthClasses.Data;
using GoogleEarthClasses.Entities;
namespace GoogleEarthClasses.Logic
{
    class LLocationData
    {
        public static List<ELocationData>  SelectAll()
        {
            DataTable dt = DLocationData.SelectAll();
            List<ELocationData> locations = new List<ELocationData>();
            ELocationData tempLocation;
            foreach (DataRow dr in dt.Rows){
                //(Int32 locationId, DateTime createdOn, string createdBy, EAsset asset, 
                //long longitude, long latitude, long altitude)
                tempLocation = new ELocationData(ConvertHelper.ToInt32(dr["LocationId"]),
                                        ConvertHelper.ToDateTime(dr["CreatedOn"]),
                                        ConvertHelper.Tostring(dr["CreatedBy"]),
                                        new EAsset(ConvertHelper.ToInt32(dr["AssetFk"])),
                                        ConvertHelper.Tolong(dr["Longitude"]),
                                        ConvertHelper.Tolong(dr["Latitude"]),
                                        ConvertHelper.Tolong(dr["Altitude"]));
                locations.Add(tempLocation);
            }
            return locations;
        }
    }
}
